package com.googlecode.animator.data
{
	public class PositionObject3D extends ValueObject
	{		
		public var x:Number = 0;
		
		public var y:Number = 0;
		
		public var z:Number = 0;
		
		public var label:String;
		
		public var name:String;
		
		override public function clone(src:* = null):IValueObject
		{	
			if(src == null)
			{
				throw(new Error("PositionObject3D cannot be cloned. Use one of its subclasses."));
			}
			src.label = this.label;
			src.name = this.name;		
			src.x = this.x;
			src.y = this.y;
			src.z = this.z;

			return src;					
		}
		
		override public function toXML(src:XML = null):XML
		{
			if(src == null)
			{
				src = new XML(<positionObject name={this.name} label={this.label}></positionObject>);
			}
			src.@name = this.name;
			src.@label = this.label;
			src.appendChild(<x>{this.x}</x>);
			src.appendChild(<y>{this.y}</y>);
			src.appendChild(<z>{this.z}</z>);
			
			return src;
		}
		
		override public function fromXML(src:XML):void
		{
			this.name = src.@name;
			this.label = src.@label;
			this.x = src.x;
			this.y = src.y;
			this.z = src.z;
		}
	}
}